1. Field of the Invention
The present invention relates to an apparatus, method, and program for measuring a distance to an object based on images captured by a plurality of cameras.
2. Discussion of Background Art
Generally, when CCD (Charge-Coupled Device) cameras and the like capture an object in a stereoscopic manner to measure the distance from the cameras to the object, various errors affect the measuring accuracy.
One typical example is camera distortion of the lens used for the camera. Camera distortion is an error by which the shape of the captured object suffers from barrel distortion or pincushion distortion. More complicated distortion occurs if the accuracy of the lens is low, and in the case where a resinous or glass protection cover or filter is attached to the camera, the distortion of the protection cover affects as a lens, which then causes distortion on an image captured by the camera.
Once a distortion occurs on the image captured, error is contained in the result of calculations for obtaining the distance to the object.
Camera distortion can be eliminated by the combination of lenses or the provision of the lens aperture. However, correction (calibration) of the captured image can also eliminate the camera distortion.
For example, as disclosed in Japanese Laid-open Patent Application No. 11-355813 (Page 3, FIG. 6, etc.), if camera distortion increases in accordance with distance from the center of the lens (center of the image), the amount of distortion is given by a function in which distance “r” from the center of the lens (center of the image) is considered as a parameter. Therefore, by taking an image of a lattice pattern and measuring at a plurality of points the amount of distortion compared with the actual object, curvature of the lattice on the captured image can be given as a function (approximate expression) of “r”. With the use of this function, distortion can be eliminated from captured images.
Even without the use of the approximate expression, as long as storing the corresponding relations between the captured image of the lattice pattern and the actual lattice pattern for each pixel, distortion can be eliminated with the use of this corresponding relations.
In the case where the position of the object is detected (stereo distance measurement) by means of a plurality of cameras, measuring the distance to the object is performed based on each camera position and each pixel corresponding to the object on the image captured by each camera, and also with the principle of triangulation. In the manner of detecting the position of the object using the principle of triangulation, the lens system of each camera has to be a pin-hole camera model basis. As shown in FIG. 7, the pin-hole camera model is a model such that only rays of light (incident light) coming through a base point position (pin-hole H) reach an image plane to associate three-dimensional space (x, y, z) with two-dimensional space (u, v) on the image plane. As described above, the pin-hole camera model considers the case where rays of incident light form a captured image after passing through a single pin-hole.
However, in the camera equipped with a lens system for practical use, rays of incident light do not actually pass through a single pin-hole, which possibly causes a measurement error due to deviation between the model and reality. With respect to an error of the stereo distance measurement, Japanese Laid-open Patent Application No. 11-355813 also discloses a technique to measure the distance after correcting the distortion such as described above. However, such a correction does not adjust errors derived from the pin-hole camera model.
Further, a point taken by a reference camera is projected on a line of an image that is taken by the other camera. Such a line is so called “epipolar line”. The epipolar line becomes a curved line due to distortion of the image. In this instance, upon searching a point of the reference camera on an image of the other camera, it is not sufficient to search the point merely on the straight line, so that stereo matching is executed based on characteristics extracted from each image. This requires a large amount of processing. Especially, if these cameras are used as a viewing apparatus with a wide-angle lens and mounted on a robot or vehicle, captured images inevitably contain distortions.
Therefore, the present invention seeks to provide a distance measurement apparatus for measuring the distance to the object on the basis of captured images, which can correct distortion and allow accurate calculations of the distance with a small amount of processing.